package org.nativejpa;

import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import java.util.Map;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 * @create 2009-3-18 23:27:02
 */
public class PersistenceProviderImpl implements PersistenceProvider {

    public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
        throw new UnsupportedOperationException("PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map)");
    }

    public EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
        // init EntityManagerFactoryBuilder
        return EntityManagerFactoryBuilder.getInstance().createEntityManagerFactory(persistenceUnitName, properties);
    }

    public static void main(String[] args) {
        Persistence.createEntityManagerFactory("Default");
    }
}

